package com.sthz.facepay.mapper;

import static org.apache.ibatis.jdbc.SqlBuilder.BEGIN;
import static org.apache.ibatis.jdbc.SqlBuilder.INSERT_INTO;
import static org.apache.ibatis.jdbc.SqlBuilder.SET;
import static org.apache.ibatis.jdbc.SqlBuilder.SQL;
import static org.apache.ibatis.jdbc.SqlBuilder.UPDATE;
import static org.apache.ibatis.jdbc.SqlBuilder.VALUES;
import static org.apache.ibatis.jdbc.SqlBuilder.WHERE;

import com.sthz.facepay.model.Point;

public class PointSqlProvider {

    public String insertSelective(Point record) {
        BEGIN();
        INSERT_INTO("st_point");
        
        if (record.getId() != null) {
            VALUES("id", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getConsume_point() != null) {
            VALUES("consume_point", "#{consume_point,jdbcType=INTEGER}");
        }
        
        if (record.getGift_point() != null) {
            VALUES("gift_point", "#{gift_point,jdbcType=INTEGER}");
        }
        
        return SQL();
    }

    public String updateByPrimaryKeySelective(Point record) {
        BEGIN();
        UPDATE("st_point");
        
        if (record.getConsume_point() != null) {
            SET("consume_point = #{consume_point,jdbcType=INTEGER}");
        }
        
        if (record.getGift_point() != null) {
            SET("gift_point = #{gift_point,jdbcType=INTEGER}");
        }
        
        WHERE("id = #{id,jdbcType=INTEGER}");
        
        return SQL();
    }
}